package com.xyyl.patient.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.xyyl.patient.core.controller.BaseController;
import com.xyyl.patient.core.util.ResponseBodyResult;
import com.xyyl.patient.entity.pharmacy.Pharmacy;
import com.xyyl.patient.service.user.UserService;

import java.util.List;

/**
 * @ClassName: PrescriptionController
 * @Description: 处方管理Controller
 * 1.我的处方列表
 * 2.删除处方
 * 3.处方详情
 * 4.一键寻药（验证码、二维码）
 * @author  chengjun
 * @date 2017年8月16日
 *
*/
@RestController
@RequestMapping("/prescription")
public class PrescriptionController extends BaseController {
	

	@Autowired
	private UserService userService;
		/**
		 * @param @param  id
		 * @param @return 参数
		 * @return JSONObject    返回类型
		 * @throws
		 * @Title: getBestPharmacy
		 * @Description: 一键寻药
		 */
	@RequestMapping(value = "/getBestPharmacy", method = RequestMethod.GET)
	public JSONObject getBestPharmacy(@RequestParam double latitude, @RequestParam double longitude) {
		List<Pharmacy> pharmacy = userService.getBestPharmacy(latitude,longitude);
		return ResponseBodyResult.success("OK",pharmacy);
	}
}